module IPFS.Client.Command.Config (
 show,
 get
) where

import Data.Argonaut (Json, fromString)
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Foreign.Object as O
import IPFS.Client (Client)
import IPFS.Client.Command (Command, defCommand)
import IPFS.Client.Utils.SendRequest (execRawJsonCommand)

------------------------------show-----------------------------
showCommand::Command
showCommand = defCommand {path = "config/show", args = Nothing ,qs = O.empty}

show::Client -> Aff (Either String Json)
show  client = execRawJsonCommand client showCommand

------------------------------getCommand-----------------------------
getCommand::String -> Command 
getCommand key = defCommand {path = "config" , args = Just [fromString key],qs = O.empty }

get::Client -> String -> Aff (Either String Json)
get client key = execRawJsonCommand client (getCommand key)